<?php

namespace App\Admin\Controllers;

use App\Models\BlindBoxLevel;
use App\Models\Category;
use Encore\Admin\Form;
use Encore\Admin\Grid;
use Encore\Admin\Show;
use Encore\Admin\Controllers\AdminController;
use Illuminate\Support\Facades\Storage;

class BlindBoxLevelsController extends AdminController
{
    protected $title = '盲盒等级'; 
    
    protected function grid()
    {
        $grid = new Grid(new BlindBoxLevel());
	
	    $grid->disableExport();
	    
	    $grid->column('name', '盲盒等级');
      
       
	    $grid->column('created_at', '创建时间')->display(function () {
	    	return $this->created_at->toDatetimeString();
	    });
        return $grid;
    }
    
    protected function detail($id)
    {
        $show = new Show(BlindBoxLevel::findOrFail($id));



        return $show;
    }
    
    protected function form()
    {
        $form = new Form(new BlindBoxLevel());
	    $form->text('name', '盲盒等级');
        $form->image('icon', '背景图标')
            ->uniqueName()
            ->creationRules('required');
        $form->image('image', '文字背景图标')
            ->uniqueName()
            ->creationRules('required');

         $form->image('cover', '盲盒订单背景图标')
            ->uniqueName()
            ->creationRules('required');
        $form->text('background_color', '边框颜色');
        /*dd($uploadDisk);*/
        return $form;
    }

   
}
